<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
    String actionURL = path + "/cms/customer/doQuery.do";
%>
<!doctype html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<base href="<%=basePath%>">
		<title>会员管理</title>
		<link href="css/css-main.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="css/msgbox/jquery.msgbox.css" />
		<script type="text/javascript" src="js/jquery.min.js">
</script>
		<script type="text/javascript" src="js/msgbox/jquery.dragndrop.min.js">
</script>
		<script type="text/javascript" src="js/msgbox/msgbox.js">
</script>
		<script type="text/javascript" src="js/common.js">
</script>
		<script type="text/javascript" src="js/cardInterface.js">
</script>
	</head>
	<script type="text/javascript">
function selectAll(fromName, boxname, inputname) {
	var f = document.forms[fromName];
	var length = f.elements.length;
	for ( var i = 0; i <= length; i++) {
		if (f.elements[i].name == boxname) {
			f.elements[i].checked = !f.elements[i].checked;
		}
	}
}
/*
 复选框删除功能 可以传递自定义描述
 *  
 */
function confirmDel(doc) {
	var delNum = 0;
	var innerIndexs = doc.getElementsByName("innerIndexs");
	//var arrayObj = new Array();
	for ( var i = 0; i < innerIndexs.length; i++) {
		if (innerIndexs[i].checked) {
			delNum++;
		}
	}
	//alert(arrayObj.length);
	if (delNum <= 0) {
		alert("请至少选择一条待删除记录");
		return false;
	}
	var desc = "你确定要删除" + delNum + "条记录吗？\n记录删除后将无法恢复！";
	if (window.confirm(desc)) {
		//for ( var i = 0; i < len; i++) {
		//	if (f.innerIndexs[i].checked) {
		//		var a = document.getElementById("cardNo" + f.innerIndexs[i].value).value;
		//		var result = myact.DelUserInfo(a);
		//		if (result == 0) {
		//			//myact.UpLoad("0");
		//			var b = f.innerIndexs[i].value;
		//			arrayObj.push(b);
		//		} else {
		//			f.innerIndexs[i].checked = false;
		//		}
		//	}
		//}
		//if (arrayObj.length > 0) {
			document.forms("form_del").action = "cms/customer/doDel.do";
			document.forms["form_del"].submit();
			return true;
		//} else {
		//	alert("删除失败！");
		//}
	} else {
		return false;
	}
}

//增加会员信息
function addCustomer(){
	var form = document.getElementById('regform');
	form.action = "cms/customer/toAdd.do";
	form.submit();
}

</script>

	<body>
	<!--  
		<object classid="clsid:9ED6510F-E648-40b0-B549-537227261E19"
			id="myact"></object>
		-->	
		<div class="main-con">
			<!--//导航位置层-->

			<div class="main-bar">
				<span class="bar-position">当前位置：<a href="#">会员管理</a> &gt;&gt;
					会员信息管理</span>
			</div>
			<div class="cont_right_cont">
				<div>
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100" valign="middle">
								<input name="button2"
										type="button" class="btn-Yes" id="button2" value="增  加"
										onclick="addCustomer();">
							</td>
							<td valign="middle">
								<input name="button2" type="button"
									onclick="confirmDel(document);" class="btn-Yes" id="button2"
									value="删  除">
							</td>
							<!-- 
							<td valign="middle">
								<input name="button3" type="button"
									onclick="confirmUpload();" class="btn-No" id="button3"
									value="一键上传" style="font-style: '黑体 ' ; font-weight: bold;">
							</td>
							 -->
							<td align="right" valign="middle">
								查询条件：
							</td>
							<td width="120" height="40" align="right" valign="middle">
								<select name="select2" class="data-searchtxt-select"
									id="queryConditon_key" style="width: 100px">
									<option value="cardNo">
										会员卡号
									</option>
									<option value="custName">
										姓名
									</option>
									<option value="numberID">
										证件号
									</option>
									<option value="tel">
										联系电话
									</option>
								</select>
							</td>
							<td width="150" align="right" valign="middle">
								<span style="padding: 0px"> <input name="textfield9"
										type="text" class="data-searchtxt-runtime"
										id="queryConditon_value" value="" /> </span>
							</td>
							<td width="100" align="right" valign="middle">
								<input name="queryBtn" type="button" class="data-searchbtn"
									id="queryBtn" value="查 询" onclick="do_search(1);" />
							</td>
						</tr>
					</table>
				</div>
				<form name="form_del" id="form_del" target="hid" action="">
					<table width="100%" border="0" cellspacing="0" cellpadding="0"
						class="datalist">
						<tr>
							<th width="4%">
								<input type="checkbox" name="checkbox" id="checkbox"
									onclick="selectAll('form_del','innerIndexs','cardNo');">
							</th>
							<th width="9%">
								会员姓名
							</th>
							<th width="4%">
								性别
							</th>
							<th width="9%">
								证件类型
							</th>
							<th width="14%">
								证件号
							</th>
							<th width="8%">
								会员级别
							</th>
							<th width="10%">
								会员卡号
							</th>
							<th width="12%">
								职业
							</th>
							<th width="10%">
								联系电话
							</th>
							<th colspan="2">
								操作
							</th>
						</tr>
						<!-- 记录为空 -->
						<s:if test=" results.size == 0">
						</s:if>
						<!-- 存在记录 -->
						<s:if test=" results.size > 0">
							<!--显示List记录！-->
							<s:iterator value="results" status="s">
								<tr>
									<td>
										<input type="checkbox" name="innerIndexs" id="innerIndexs"
											value='<s:property value="results[#s.index].customerId"/>' />
									</td>
									<td>
										<a
											href="cms/customer/doShowCustomer.do?innerIndex=<s:property value="results[#s.index].customerId"/>"><s:property
												value="results[#s.index].custName" /> </a>
									</td>
									<td>
										<s:if test="results[#s.index].sex == 1">
									男
									</s:if>
										<s:else>
									女
									</s:else>
									</td>
									<td>
										<s:if test="results[#s.index].typeID == 1">
									身份证
									</s:if>
										<s:elseif test="results[#s.index].typeID == 2">
									军官证
									</s:elseif>
										<s:else>
									其他证件
									</s:else>
									</td>
									<td>
										<s:property value="results[#s.index].numberID" />
									</td>
									<td>
										<s:property
											value="results[#s.index].clientLevelId.clientLevelName" />
									</td>
									<td>
										<s:property value="results[#s.index].cardNo" />
									</td>
									<td>
										<input type="hidden" name="cardNo"
											value='<s:property value="results[#s.index].cardNo"/>'
											id='cardNo<s:property value="results[#s.index].customerId"/>' />
										<s:property value="results[#s.index].profession" />
									</td>
									<td>
										<s:property value="results[#s.index].tel" />
									</td>
									<s:if test="results[#s.index].status == 0">
										<td width="11%">
											<a id="queryHref" href="javascript:void(0)"
												onclick="doLost(<s:property value="results[#s.index].customerId"/>,<s:property value="results[#s.index].cardNo"/>,1,'挂失')"
												class="ico_treat">挂失</a>
										</td>
									</s:if>
									<s:elseif test="results[#s.index].status == 1">
										<td width="11%">
											<a id="queryHref" href="javascript:void(0)"
												onclick="doLost(<s:property value="results[#s.index].customerId"/>,<s:property value="results[#s.index].cardNo"/>,0,'恢复')"
												class="ico_treat">启用</a>
										</td>
									</s:elseif>
									<s:else>
										<td colspan="2">
											用户已经注销
										</td>
									</s:else>
									<s:if test="results[#s.index].status != 2">
										<td>
											<a
												href="cms/customer/toMod.do?innerIndex=<s:property value="results[#s.index].customerId"/>"
												class="ico_edit">修改</a>
										</td>
									</s:if>
								</tr>
							</s:iterator>
						</s:if>
					</table>
				</form>
				<form name="pages" method="post" id="regform">
					<!--隐藏域 Start -->
					<!-- 引入分页和排序 -->
					<div style="display: none">
						<input id="curPage" type="hidden" name="page.curPage"
							value="<s:property value='page.curPage'/>">
						<input id="numPerPage" type="hidden" name="page.numPerPage"
							value="<s:property value='page.numPerPage'/>">
						<input type="hidden" id="queryConditon_key_hidden"
							name="queryConditon.key"
							value="<s:property value='queryConditon.key'/>">
						<input id="queryConditon_value_hidden" type="hidden"
							name="queryConditon.value"
							value="<s:property value='queryConditon.value'/>">
						<iframe name="hid" id="hid" src="" height="0px"></iframe>
					</div>

					<!--隐藏域 End   -->
					<div <s:if test=" results.size == 0">style="display:none"</s:if>>
						<%@include file="/jsp/cms/common/page.txt"%>
					</div>
				</form>
			</div>
		</div>
	</body>
</html>
